package com.vframework.common.service;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import com.vframework.base.exception.BaseException;
import com.vframework.common.constant.GlobalConstant;

/***************************************************************
 * Name:        Init.java     
 * Create At:   2010-04-22
 * Module:      系统启动初始化文件
 * Description: [启动服务时加载系统全局参数]
 * Author       shanzhitong
 * ------------------------------------------------------------
 * 修改历史
 * 序号  日期  修改人   修改原因
 * 1
 * 2
***************************************************************/
@Component
public class InitService implements CommandLineRunner {
    private static final Logger logger = Logger.getLogger(InitService.class);
	@Autowired
	private CommonService commonService;
	
	@Override
	public void run(String... args) throws BaseException {
	    initDict();//初始化字典表
        initCity();//初始化字典表
        initGroup();//初始化字典表
        logger.info("|#Initia Service completed|#");
	}

	private void initDict() throws BaseException {
		GlobalConstant.DICT_LIST = commonService.getDictList();
	}

	private void initCity() throws BaseException {
		GlobalConstant.CITY_LIST = commonService.getCityList();
	}

	private void initGroup() {
	    
	}
}
